import React from 'react'
import './style.scss'
import {Link} from 'react-router-dom'

import SearchInput from '../SearchInput'

export default class HomeHeader extends React.Component {
     constructor(props, context){
        super(props, context)
        this.state = {
            kwd: ''
        }
    }
    render(){
        return (
            <div className="clearfix homeHeader">
                <Link to='/city' className="fl left">
                    <span>{this.props.cityName}</span>
                    <i className="iconfont icon-jiantouxia"></i>
                </Link>
                <SearchInput enterHandle={this.enterHandle.bind(this)} value=''></SearchInput>
                <div className="fr right">
                    <Link to='/login'>
                        <i className="iconfont icon-wodedamaijihuo"></i>
                    </Link>
                </div>
            </div>
        )
    }
    enterHandle(value) {
        this.props.history.push('/search/all/' + encodeURIComponent(value))
    }
}